LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE            := libdobby
LOCAL_SRC_FILES         := Dobby/libraries/$(TARGET_ARCH_ABI)/libdobby.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/dobby/
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_LDFLAGS := $(LOCAL_PATH)/Dobby/armeabi-v7a/libdobby.a
include $(CLEAR_VARS)

LOCAL_MODULE    := TC

LOCAL_CFLAGS := -w -s -Wno-error=format-security -fvisibility=hidden -fpermissive -fexceptions
LOCAL_CPPFLAGS := -w -s -Wno-error=format-security -fvisibility=hidden -Werror -std=c++17
LOCAL_CPPFLAGS += -Wno-error=c++11-narrowing -fpermissive -Wall -fexceptions
LOCAL_LDFLAGS += -Wl,--gc-sections,--strip-all,-llog
LOCAL_LDLIBS += -llog -landroid -lEGL -lGLESv2 -lGLESv3 -lGLESv1_CM -lz -lvulkan
LOCAL_ARM_MODE := arm

LOCAL_STATIC_LIBRARIES := libdobby curl ssl crypto 

LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/HookEgl
LOCAL_C_INCLUDES += $(LOCAL_PATH)/Engine
LOCAL_C_INCLUDES += $(LOCAL_PATH)/ImGui
LOCAL_C_INCLUDES += $(LOCAL_PATH)/ImGui/backends
FILE_LIST += $(wildcard $(LOCAL_PATH)/ImGui/*.c*)

LOCAL_SRC_FILES := main.cpp \
    xdl/xdl.c \
    xdl/xdl_iterate.c \
    xdl/xdl_linker.c \
    xdl/xdl_lzma.c \
    xdl/include/xdl.h \
    xdl/xdl_util.c \
	ByNameModding/Tools.cpp \
    ByNameModding/fake_dlfcn.cpp \
    ByNameModding/Il2Cpp.cpp \
	HookEgl/HookEgl.cpp \
    ImGui/imgui.cpp \
    ImGui/imgui_draw.cpp \
    ImGui/imgui_widgets.cpp \
    ImGui/imgui_tables.cpp \
    ImGui/imgui_impl_vulkan.cpp \
    ImGui/backends/imgui_impl_opengl3.cpp \
    ImGui/backends/imgui_impl_android.cpp \
    Substrate/hde64.c \
	Substrate/SubstrateDebug.cpp \
	Substrate/SubstrateHook.cpp \
	Substrate/SubstratePosixMemory.cpp \
	Substrate/SymbolFinder.cpp \
    Engine/hook.cpp \
    Engine/class.cpp \
    Engine/struct.cpp \
    


include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := curl
LOCAL_SRC_FILES := curl/$(TARGET_ARCH_ABI)/lib/libcurl.a
include $(PREBUILT_STATIC_LIBRARY)

# Add crypto static library prebuilt
include $(CLEAR_VARS)
LOCAL_MODULE := crypto
LOCAL_SRC_FILES := openssl/$(TARGET_ARCH_ABI)/lib/libcrypto.a
include $(PREBUILT_STATIC_LIBRARY)

# Add ssl static library prebuilt
include $(CLEAR_VARS)
LOCAL_MODULE := ssl
LOCAL_SRC_FILES := openssl/$(TARGET_ARCH_ABI)/lib/libssl.a
include $(PREBUILT_STATIC_LIBRARY)
